{% extends 'index/base.html' %}

{% block title %}
<title>文章详情页</title>
{% endblock title %}

{% block js %}
<script type="text/javascript" src="/static/index/js/detail.js"></script>
{% endblock js %}


{% block content %}
<div class="detail_con fl">
    <h3>{{ news.title }}</h3>
    <div class="detail_about clearfix">
        <span class="time_souce fl">{{ news.create_time }} 来源: {{ news.source }}</span>
        <span class="comment fr">3</span>
    </div>

    <p class="summary">
        摘要：{{ news.digest }}
    </p>

    {{ news.content | safe }}
    
{% if news.can_collect %}
<a href="javascript:;" class="collection block-center" data-news-id='{{ news.id }}'>收藏</a>
{% else %}
<a href="javascript:;" class="collected block-center" data-news-id='{{ news.id }}'><span class="out">已收藏</span><span class="over">取消收藏</span></a>
{% endif %}

{% if not user %}
<div class="comment_form_logout">
    登录发表你的评论
</div>
{% endif %}

<form action="" class="comment_form" data-news-id="{{ news.id }}">
    <div class="person_pic">
        <img src="/static/index/images/cat.jpg" alt="用户图标">
    </div>
    <textarea placeholder="请发表您的评论" class="comment_input"></textarea>
    <input type="submit" name="" value="评 论" class="comment_sub">
</form>


<div class="comment_count">
    4条评论
</div>

<div class="comment_list_con">
    {% for c in comment_list %}

    
    <div class="comment_list">
        <div class="person_pic fl">
            {% if c.get('user_avatar_url') %}
            <img src="{{ c.get('user_avatar_url') }}" alt="用户图标">
            {% else %}
            <img src="/static/index/images/worm.jpg" alt="用户图标">
            {% endif %}
        </div>


        {% if c.parent %}
        <div class="user_name fl">{{ c.get('user_nick_name') }} 回复 @{{ c.get('parent').get('user_nick_name') }}</div>
        <div class="comment_text fl">
                {{ c.get('content') }}
        </div>
        <div class="reply_text_con fl">
            <div class="user_name2">{{ c.get('parent').get('user_nick_name') }}</div>
            <div class="reply_text">
                {{ c.get('parent').get('content') }}
            </div>
        </div>
        {% else %}
        <div class="user_name fl">{{ c.get('user_nick_name') }}</div>
        <div class="comment_text fl">
            {{ c.get('content') }}
        </div>
        {% endif %}


        <div class="comment_time fl">{{ c.get('create_time') }}</div>
        <!-- <a href="javascript:;" class="comment_up fr" data-comment-id="{{ c.get('id') }}">赞</a> -->
        {% if c in like_comments %}
        <a href="javascript:;" class="comment_up has_comment_up fr" data-comment-id="{{ c.get('id') }}">{{ c.get('like_count') }}</a>
        {% else %}
        <a href="javascript:;" class="comment_up fr" data-comment-id="{{ c.get('id') }}">{{ c.get('like_count') }}</a>
        {% endif %}
        <a href="javascript:;" class="comment_reply fr" data-comment-id="{{ c.get('id') }}">回复</a>
        <from class="reply_form fl" data-news-id="{{ news.id }}" data-comment-id="{{ c.get('id') }}">
            <textarea  class="reply_input"></textarea>
            <input type="submit" name="" value="回复" class="reply_sub fr">
            <input type="reset" name="" value="取消" class="reply_cancel fr">
        </from>            
    </div>



    <!-- <div class="comment_list">
        <div class="person_pic fl">
            <img src="{{ c.get('user_avatar_url') }}" alt="用户图标">
        </div>    
        <div class="user_name fl">{{ c.get('user_nick_name') }}</div>
        <div class="comment_text fl">
            {{ c.get('content') }}
        </div>
        <div class="comment_time fl">{{ c.get('create_time') }}</div>
        <a href="javascript:;" class="comment_up fr">赞</a>
        <a href="javascript:;" class="comment_reply fr">回复</a>
        <from class="reply_form fl" data-news-id="{{ news.id }}" data-comment-id="{{ c.get('id') }}">
            <textarea  class="reply_input"></textarea>
            <input type="submit" name="" value="回复" class="reply_sub fr">
            <input type="reset" name="" value="取消" class="reply_cancel fr">
        </from>            
    </div> -->

    
    {% endfor %}

</div>
    
    
</div>
{% endblock content %}


{% block author_card %}
<div class="author_card">
<a href="#" class="author_pic"><img src="/static/index/images/user_pic.png" alt="author_pic"></a>
<a href="#" class="author_name">{{ news_author.nick_name }}</a>
<div class="author_resume">{{ news_author.signature }}</div>
<div class="writings"><span>总篇数</span><b>{{ news_author.news_num }}</b></div>
<div class="follows"><span>粉丝</span><b>{{ news_author.followers_num }}</b></div>
{% if news_author.can_follow %}
<a href="javascript:;" class="focus fr" data-user-id="{{ news_author.id }}">关注</a>
{% else %}
<a href="javascript:;" class="focused fr" data-user-id="{{ news_author.id }}"><span class="out">已关注</span><span class="over">取消关注</span></a>
{% endif %}
</div>  
{% endblock author_card %}

        


    





